﻿using EmitMapper;

namespace OrderingPlatform.MvcExtension
{
   public  class AutoMapperManage
    {
        public static T Map<F, T>(F model)
        {
            if (model == null)
                return default(T);
            ObjectsMapper<F, T> mapper =
      ObjectMapperManager.DefaultInstance.GetMapper<F, T>();
            return mapper.Map(model);
        }
        public static T Map<F, T>(F model, T toModel)
        {
            if (model == null)
                return default(T);
            ObjectsMapper<F, T> mapper =
      ObjectMapperManager.DefaultInstance.GetMapper<F, T>();
            return mapper.Map(model, toModel);
        }
    }
}
